require(["common", "jQuery", "coAjax", "queryString", "hash_routie"], function(jSouper, $, coAjax, QueryString, hash_routie) {
    App.init("$Cache.bus.qrcode.ecLevel", "H");
    App.init("$Cache.bus.qrcode.fill", "#000");
    App.init("$Cache.bus.qrcode.background", "#ddd");
    App.init("$Cache.bus.qrcode.text", App.get("bus_loginer.url"));
    App.init("$Cache.bus.qrcode.mImage", App.get("bus_loginer.info.logo_url"));
    App.set("$Event.bus.qrcode.upload_qrcode_to_config", function() {
        var qrcode_data = App.get("$Cache.bus.qrcode_data");
        if (!qrcode_data) {
            alert("warn", "浏览器版本过低，无法上传");
            return;
        }
        coAjax.post(appConfig.other.upload_base64_image, {
            img_base64: qrcode_data
        }, function(result) {
            var img_url = appConfig.img_server_url + result.result.key;
            alert("success", "二维码上传成功");
            coAjax.put(appConfig.bus.set_config_url, {
                data: img_url,
                key: "qrcode_url"
            }, function(result) {
                App.set("bus_loginer", result.result);
                alert("success", "门店二维码设置成功");
            });
        });
    });
});